#include "SortingStrategy.h"
#include <iostream>
using namespace std;

template <class T>
class MyArray
{
private:
	int m_Size;
	T* m_Data;
	SortingStrategy<T>* m_Sorter;
public:
	//Constructor
	MyArray(int size) {
		m_Size = size;
		m_Data = new T[m_Size];
	}
	//Get element based on index
	T getElement(int index) {
		if(index >= m_Size || index < 0)
			return NULL;

		return m_Data[index];
	}
	//Set element based on index
	void setElement(int index, T data) {
		if(index >= m_Size || index < 0)
			return;

		m_Data[index] = data;
	}
	//Sort data using SortingStrategy
	void sort() {
		//m_Sorter = new InterchangeSort<T>();
		m_Sorter->sort(this->m_Data, this->m_Size);		
	}
	//Set SortingStrategy
	void setSortingStrategy(SortingStrategy<T>* sorter) {
		m_Sorter = sorter;
	}
	//Destructor
	virtual ~MyArray() {		
		delete m_Data;		
		//delete m_Sorter;
	}	
};
